<?php
// +----------------------------------------------------------------------
// | 有小象汇 自研正版源码 赋能开发者
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 http://www.uxphp.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 有小象汇并不是自由软件，未经许可不能去掉有小象汇相关版权
// +----------------------------------------------------------------------
// | Author:  有小象汇
// +----------------------------------------------------------------------
/**
 * 员工端API
 */
use app\http\middleware\AllowOriginMiddleware;
use app\staffapi\middleware\StaffAuthTokenMiddleware;
use think\facade\Config;
use think\facade\Route;
use think\Response;

Route::group(function () {
    //无需授权接口
    Route::post('login', 'LoginController/login')->name('login');    //员工账号密码登录
    Route::post('upload/image', 'PublicController/upload_image')->name('uploadImage');//图片上传
    //分片上传本地视频
    Route::post('upload/video', 'PublicController/videoUpload')->option(['real_name' => '分片上传本地视频']);
    Route::get('system_data', 'PublicController/systemData')->option(['real_name' => '获取系统配置']);
    //君子去回调地址
    Route::post('php_jzq_callback', 'PublicController/php_jzq_callback')->option(['real_name' => '君子签回调']);
    //君子签个人自定义签名图片
    Route::post('vendor/uploadPersSign', 'VendorController/uploadPersSign')->name('uploadPersSign');
    //用户申请入驻
    Route::post('vendor/apply_vendor', 'VendorController/apply_vendor')->name('apply_vendor');

    //微信特约商户所有下拉框枚举
    Route::get('vendor/documenttype_lable', 'EnumController/documenttype_lable')->name('get_a');//证件类型下拉框
    Route::get('vendor/get_bank_list', 'EnumController/get_bank_list')->name('get_bank_list');//有关银行数据下拉框
    Route::get('vendor/get_city_code', 'EnumController/get_city_code')->name('get_city_code');//省市市编码



    Route::get('vendor/get_vendor_car_info', 'VendorController/get_vendor_car_info')->name('get_vendor_car_info');//车辆详情
    Route::get('vendor/getPlaceInfo', 'VendorController/getPlaceInfo')->name('getPlaceInfo');//门店详情
    Route::get('vendor/get_city', 'VendorController/get_city')->name('get_city');//获取城市信息
    Route::post('vendor/register_vendor', 'VendorController/register_vendor')->name('register_vendor');//商户注册
    Route::get('vendor/slect_bc_applyment', 'VendorController/slect_bc_applyment')->name('slect_bc_applyment');//查询补充资料or微信特约商户审核状态
    Route::get('vendor/get_applyment', 'VendorController/get_applyment')->name('get_applyment');//查看进件资料、用于申请驳回后，用户重新提交
    Route::get('vendor/get_applyment_img', 'VendorController/get_applyment_img')->name('get_applyment_img');//查看申请图片资料

    Route::group(function () {//需要授权接口
        Route::post('edit_password', 'LoginController/edit_password')->option(['real_name'=>'修改密码']);
        Route::post('logout', 'LoginController/logout')->option(['real_name'=>'退出登录']);
        Route::post('get_order_list', 'StaffController/getOrderList')->option(['real_name'=>'订单列表']);
        Route::post('order_remark', 'StaffController/orderRemark')->option(['real_name'=>'订单备注']);
        Route::post('order_cancel', 'StaffController/orderCancel')->option(['real_name'=>'取消订单']);
        Route::post('single_face_fee', 'StaffController/singleFaceFee')->option(['real_name'=>'创建当面收费']);
        Route::post('deduct_money_fee', 'StaffController/deductMoneyFee')->option(['real_name'=>'扣款']);
        Route::post('car_relet','StaffController/createRerent')->option(['real_name'=>'续租']);
        Route::post('cancel_rerent', 'StaffController/cancelRerent')->option(['real_name'=>'取消续租']);
        Route::post('accomplish_take', 'StaffController/accomplishTake')->option(['real_name'=>'完成取车']);
        Route::post('accomplish_return', 'StaffController/accomplishReturn')->option(['real_name'=>'完成还车']);
        Route::post('get_yuqi_data', 'StaffController/get_yuqi_data')->option(['real_name'=>'获取逾期弹框信息']);
        Route::post('get_yq_tq_day', 'StaffController/get_yq_tq_day')->option(['real_name'=>'获取最大逾期天数/提前还车天数']);
        Route::post('change_save_car','StaffController/changeSaveCar')->option(['real_name'=>'保存更换车型']);
        Route::post('submit_upkeep_data','StaffController/submitUpkeepData')->option(['real_name'=>'提交保养表单']);

        Route::get('get_index_data', 'PublicController/get_index_data')->option(['real_name' => '获取首页统计数据']);
        Route::get('check_staff_info', 'PublicController/checkStaffInfo')->option(['real_name' => '检测店员信息是否变动']);
        Route::get('get_order_detail', 'StaffController/getOrderDetail')->option(['real_name'=>'订单详情']);
        Route::get('get_order_refund', 'StaffController/getOrderRefund')->option(['real_name'=>'获取退款订单']);
        Route::get('get_refund_rerent','StaffController/getRefundRerent')->option(['real_name'=>'获取续租退款订单']);
        Route::get('get_refund_list','StaffController/getRefundList')->option(['real_name'=>'退款订单列表']);
        Route::get('get_rerent_list', 'StaffController/getRerentList')->option(['real_name'=>'订单续租列表']);
        Route::get('get_rerent_detail', 'StaffController/getRerentDetail')->option(['real_name'=>'续租订单详情']);
        Route::get('platoon_car', 'StaffController/platoonCar')->option(['real_name'=>'排车']);
        Route::get('store_car_list','StaffController/storeCarList')->option(['real_name'=>'获取门店车型']);
        Route::get('get_upkeep_car','StaffController/getUpkeepCar')->option(['real_name'=>'获取门店待保养列表']);
        Route::get('get_annual_car','StaffController/getAnnualCar')->option(['real_name'=>'获取门店近期年检车辆']);
        Route::get('get_commercial_insurance_car','StaffController/getCommercialInsuranceCar')->option(['real_name'=>'获取门店近期商业险车辆']);
        Route::get('get_insurance_car','StaffController/getInsuranceCar')->option(['real_name'=>'获取门店近期强险车辆']);
        Route::get('get_car_detail','StaffController/getCarDetail')->option(['real_name'=>'获取车辆详情']);
        Route::get('get_order_status','StaffController/get_order_status')->option(['real_name'=>'获取最新订单']);

        Route::get('vendor/get_home', 'VendorController/get_home')->name('get_home');//首页
        Route::post('vendor/vendor_add_car', 'VendorController/vendor_add_car')->name('vendor_add_car');//添加车辆
        Route::get('vendor/getStoreList', 'VendorController/getStoreList')->name('getStoreList');//门店下拉列表
        Route::get('vendor/getTypeInfoSelect', 'VendorController/getTypeInfoSelect')->name('getTypeInfoSelect');//车型下拉列表
        Route::get('vendor/get_vendor_car_list', 'VendorController/get_vendor_car_list')->name('get_vendor_list');//管理车辆列表
        Route::post('vendor/sjx_car', 'VendorController/sjx_car')->name('sjx_car');//上下架车辆
        Route::post('vendor/del_car', 'VendorController/del_car')->name('del_car');//删除车辆
        Route::post('vendor/checkSgin', 'VendorController/checkSgin')->name('checkSgin');//检查当前账号是否有签约数据
        Route::post('vendor/jzq_user', 'VendorController/jzq_user')->name('jzq_user');//君子签用户进行签约
        Route::get('vendor/get_shop', 'VendorController/get_shop')->name('get_shop');//获取店铺基本信息
        Route::get('vendor/get_hetong_list', 'VendorController/get_hetong_list')->name('get_hetong_list');//查询合同列表
        Route::post('vendor/up_face', 'VendorController/up_face')->name('up_face');//修改头像
        Route::get('vendor/staffinfo', 'VendorController/staffinfo')->name('staffinfo');//获取店员基础信息
        Route::get('vendor/get_linkAnonyDetail', 'VendorController/get_linkAnonyDetail')->name('get_linkAnonyDetail');//查看君子签合同
        Route::post('vendor/add_wzinfo', 'VendorController/add_wzinfo')->name('add_wzinfo');//添加违章信息
        Route::get('vendor/get_wzlist', 'VendorController/get_wzlist')->name('get_wzlist');//违章列表
        Route::get('vendor/wz_info', 'VendorController/wz_info')->name('wz_info');//违章详情
        Route::get('vendor/get_claimable_order', 'VendorController/get_claimable_order')->name('get_claimable_order');//查询当前可申请理赔的订单
        Route::post('vendor/ok_claim', 'VendorController/ok_claim')->name('ok_claim');//已完成理赔
        Route::get('vendor/check_wzyajin', 'VendorController/check_wzyajin')->name('check_wzyajin');//填写违章信息时查询该条订单违章金额总和是否超过押金
        Route::get('vendor/fundFlow', 'VendorController/fundFlow')->option(['real_name' => '资金流水列表']);//资金流水列表


    })->middleware(StaffAuthTokenMiddleware::class);


})->middleware(AllowOriginMiddleware::class);

Route::miss(function () {
    if (app()->request->isOptions()) {
        $header = Config::get('cookie.header');
        $header['Access-Control-Allow-Origin'] = app()->request->header('origin');
        return Response::create('ok')->code(200)->header($header);
    } else
        return Response::create()->code(404);
});
